using System.ComponentModel.DataAnnotations;

namespace Admin2025.Application.Configurations;

/// <summary>
/// 文件上传配置
/// </summary>
public class FileUploadSettings
{
    /// <summary>
    /// 最大文件大小（字节），默认10MB
    /// </summary>
    [Range(1, long.MaxValue, ErrorMessage = "最大文件大小必须大于0")]
    public long MaxFileSize { get; set; } = 10 * 1024 * 1024; // 10MB

    /// <summary>
    /// 允许的文件扩展名
    /// </summary>
    public string[] AllowedExtensions { get; set; } = { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp" };

    /// <summary>
    /// 允许的MIME类型
    /// </summary>
    public string[] AllowedMimeTypes { get; set; } = 
    {
        "image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"
    };

    /// <summary>
    /// 本地存储根路径
    /// </summary>
    [Required(ErrorMessage = "存储路径不能为空")]
    public string StorageRootPath { get; set; } = "wwwroot/uploads";

    /// <summary>
    /// 访问基础URL
    /// </summary>
    [Required(ErrorMessage = "访问基础URL不能为空")]
    public string BaseUrl { get; set; } = "https://localhost:7001";

    /// <summary>
    /// 是否启用缩略图生成
    /// </summary>
    public bool EnableThumbnail { get; set; } = true;

    /// <summary>
    /// 缩略图宽度
    /// </summary>
    [Range(50, 1000, ErrorMessage = "缩略图宽度必须在50-1000之间")]
    public int ThumbnailWidth { get; set; } = 200;

    /// <summary>
    /// 缩略图高度
    /// </summary>
    [Range(50, 1000, ErrorMessage = "缩略图高度必须在50-1000之间")]
    public int ThumbnailHeight { get; set; } = 200;

    /// <summary>
    /// 是否按日期分文件夹存储
    /// </summary>
    public bool OrganizeByDate { get; set; } = true;

    /// <summary>
    /// 日期分文件夹格式
    /// </summary>
    public string DateFolderFormat { get; set; } = "yyyy-MM-dd";
}
